<template>
  <div class="bottom-info-container">
    <!-- 左侧：滑动提示信息 -->
    <div class="scroll-tip-container">
      <div class="scroll-tip">
        <el-icon class="tip-icon">
          <ArrowLeft />
        </el-icon>
        <span class="tip-text">左右滑动查看更多信息</span>
        <el-icon class="tip-icon">
          <ArrowRight />
        </el-icon>
      </div>
    </div>

    <!-- 右侧：项目统计信息 -->
    <div class="project-statistics-panel">
      <div class="statistics-row">
        <div class="stat-item">
          <span class="stat-label">总计</span>
          <span class="stat-value total">{{ totalCount }}</span>
          <span class="stat-unit">个</span>
        </div>
        <div class="stat-divider"></div>
        <div class="stat-item">
          <span class="stat-label">已保存</span>
          <span class="stat-value saved">{{ savedCount }}</span>
          <span class="stat-unit">个</span>
        </div>
        <div class="stat-divider"></div>
        <div class="stat-item">
          <span class="stat-label">编辑中</span>
          <span class="stat-value editing">{{ editingCount }}</span>
          <span class="stat-unit">个</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { ArrowLeft, ArrowRight } from '@element-plus/icons-vue';

// 定义项目项的类型
interface ProjectItem {
  id?: string | number;
  isEditing?: boolean;
  [key: string]: any;
}

// 定义组件属性
const props = defineProps<{
  // 项目列表数据
  projectList: ProjectItem[];
}>();

// 计算统计数据
const totalCount = computed(() => props.projectList.length);
const savedCount = computed(() => props.projectList.filter((p) => p.id).length);
const editingCount = computed(() => props.projectList.filter((p) => p.isEditing).length);
</script>

<style scoped>
/* ==================== 底部信息容器样式 ==================== */

.bottom-info-container {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-top: 16px;
  gap: 20px;
}

/* ==================== 滑动提示样式 ==================== */

.scroll-tip-container {
  flex-shrink: 0;
}

.scroll-tip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  color: #909399;
  background-color: #f5f7fa;
  border: 1px solid #e4e7ed;
  padding: 6px 12px;
  border-radius: 4px;
  display: inline-flex;
}

.tip-icon {
  font-size: 14px;
  color: #909399;
}

.tip-text {
  font-size: 12px;
  color: #909399;
}

/* ==================== 项目统计面板样式 ==================== */

.project-statistics-panel {
  background: linear-gradient(135deg, #f8faff 0%, #f0f7ff 100%);
  border: 1px solid #e1ecff;
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: 0 2px 8px rgba(64, 158, 255, 0.08);
  min-width: 320px;
  flex-shrink: 0;
}

.statistics-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 1;
}

.stat-label {
  font-size: 12px;
  color: var(--el-text-color-regular);
  font-weight: 500;
  line-height: 1;
}

.stat-value {
  font-size: 20px;
  font-weight: bold;
  line-height: 1;
  margin: 2px 0;
}

.stat-value.total {
  color: var(--el-color-primary);
}

.stat-value.saved {
  color: #10b981;
}

.stat-value.editing {
  color: #f59e0b;
}

.stat-unit {
  font-size: 11px;
  color: var(--el-text-color-placeholder);
  line-height: 1;
}

.stat-divider {
  width: 1px;
  height: 32px;
  background: linear-gradient(to bottom, transparent, #e1ecff, transparent);
  margin: 0 8px;
}

/* 响应式调整 */
@media (max-width: 768px) {
  .bottom-info-container {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .scroll-tip-container {
    text-align: center;
  }

  .project-statistics-panel {
    min-width: 280px;
    padding: 12px 16px;
  }

  .statistics-row {
    gap: 8px;
  }

  .stat-divider {
    height: 28px;
    margin: 0 6px;
  }

  .stat-value {
    font-size: 18px;
  }
}
</style>
